package cn.iocoder.yudao.module.hs.dal.mysql.rawmaterialorder;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.hs.dal.dataobject.rawmaterialorder.RawMaterialOrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.hs.controller.admin.rawmaterialorder.vo.*;

/**
 * 领料单信息 Mapper
 *
 * @author 航盛
 */
@Mapper
public interface RawMaterialOrderMapper extends BaseMapperX<RawMaterialOrderDO> {

    default PageResult<RawMaterialOrderDO> selectPage(RawMaterialOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RawMaterialOrderDO>()
                .eqIfPresent(RawMaterialOrderDO::getCode, reqVO.getCode())
                .eqIfPresent(RawMaterialOrderDO::getRawMaterialOrderNo, reqVO.getRawMaterialOrderNo())
                .eqIfPresent(RawMaterialOrderDO::getModeCode, reqVO.getModeCode())
                .eqIfPresent(RawMaterialOrderDO::getMaterialCount, reqVO.getMaterialCount())
                .eqIfPresent(RawMaterialOrderDO::getFromWarehouseCode, reqVO.getFromWarehouseCode())
                .eqIfPresent(RawMaterialOrderDO::getToWarehouseCode, reqVO.getToWarehouseCode())
                .betweenIfPresent(RawMaterialOrderDO::getRecordDate, reqVO.getRecordDate())
                .betweenIfPresent(RawMaterialOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RawMaterialOrderDO::getId));
    }

}